package org.openmore.consumer.service.feignImpl;

import feign.hystrix.FallbackFactory;
import org.openmore.consumer.dto.common.BaseResponse;
import org.openmore.consumer.dto.common.PermissionDto;
import org.openmore.consumer.service.feign.PermissionService;
import org.springframework.stereotype.Component;

@Component
public class PermissionServiceImpl extends BaseFeignFallback implements FallbackFactory<PermissionService> {
    @Override
    public PermissionService create(Throwable cause) {
        return new PermissionService() {
            @Override
            public BaseResponse selectAllByPage(String type, String name, Integer pageNum, Integer pageSize) {
                return getFallBackResponse();
            }

            @Override
            public BaseResponse getPermissionTree() {
                return getFallBackResponse();
            }

            @Override
            public BaseResponse getGrantedPermissionByRole(String id) {
                return getFallBackResponse();
            }

            @Override
            public BaseResponse getPermissionById(String id) {
                return getFallBackResponse();
            }

            @Override
            public BaseResponse updatePermission(PermissionDto permission) {
                return getFallBackResponse();
            }

            @Override
            public BaseResponse insertPermission(PermissionDto permission) {
                return getFallBackResponse();
            }

            @Override
            public BaseResponse deletePermission(String id) {
                return getFallBackResponse();
            }
        };
    }
}
